<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>JSON 序列化接口</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="json.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a></div>
 <div class="up"><a href="book.json.html">JSON</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.jsonserializable" class="reference">

 <h1 class="title">JSON 序列化接口</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.4.0)</p>


  <div class="section" id="jsonserializable.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    实现 <span class="interfacename"><strong class="interfacename">JsonSerializable</strong></span> 的类可以
    在 <span class="function"><a href="function.json-encode.html" class="function">json_encode()</a></span> 时定制他们的 JSON 表示法。
   </p>
  </div>


  <div class="section" id="jsonserializable.synopsis">
   <h2 class="title">接口摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">JsonSerializable</strong>
     </span>
     {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="jsonserializable.jsonserialize.html" class="methodname">jsonSerialize</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>


  </div>

 </div>

 










<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a> — 指定需要被序列化成 JSON 的数据</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="json.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a></div>
 <div class="up"><a href="book.json.html">JSON</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
